package binh.developer.kungfupanda;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.TextureRegion;
import org.andengine.ui.activity.SimpleBaseGameActivity;

public class Menu extends SimpleBaseGameActivity {
	public Camera mCamera;
	public Scene mScene;

	private BitmapTextureAtlas bBg;
	private TextureRegion tBg;
	private Sprite sBg;
	
	Config config;

	@Override
	public EngineOptions onCreateEngineOptions() {
		config = new Config();
		mCamera = new Camera(0, 0, Config.C_W, Config.C_H);
		final EngineOptions engineOptions = new EngineOptions(true,
				ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(
						Config.C_W, Config.C_H), mCamera);
		return engineOptions;
	}

	@Override
	protected void onCreateResources() {
		bBg = new BitmapTextureAtlas(getTextureManager(), 1024, 512,
				TextureOptions.BILINEAR_PREMULTIPLYALPHA);
		tBg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(bBg, this,
				"resource/images/menu.png", 0, 0);
		bBg.load();

	}

	@Override
	protected Scene onCreateScene() {
		mScene = new Scene();
		sBg = new Sprite(0, 0, tBg, getVertexBufferObjectManager());
		mScene.attachChild(sBg);
		return mScene;
	}

}
